package com.it.cloud.consumer;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableEurekaClient
/**
 * ribbon配置请求方式
 * 1、@LoadBalanced//配置ribbon 默认轮询机制
 * 2、代码配置查看RibbonConfig
 * 3、配置文件查看application.yml
 * 4、优先级  配置文件>代码自定义>默认配置
 * @author admin
 *
 */
public class ConsumerApplication {
	@Bean
	@LoadBalanced//配置ribbon 默认轮询机制
	public RestTemplate restTemplate(){
		return new RestTemplate();
	} 
	
	public static void main(String[] args) {
		SpringApplication.run(ConsumerApplication.class, args);
	}
}
